package xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.command;


import xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.Editor;

/**
 * 代理模式。
 * <p>
 * 代理~~了~~类，打印相关信息。
 *
 * @author xing
 * @date 2023/2/10 15:55:20
 */
public class CommandProxy implements ICommand {
    private ICommand command;

    public CommandProxy(ICommand command) {
        this.command = command;
    }

    @Override
    public String getName() {
        return command.getName();
    }

    @Override
    public void execute(Editor editor) {
        command.execute(editor);
        System.out.println("---");
        System.out.println("I execute " + command.getName());
    }

}
